function getStyle(oEle, attr){
    if(window.getComputedStyle){
        return window.getComputedStyle(oEle, null)[attr];
    }
    return oEle.currentStyle[attr];
}

function animate(oEle, json, callback){
    //1.清空定时器,保证一个dom对象,只有一个定时器
    clearInterval(oEle.timer);
    //2.开启定时器
    oEle.timer = setInterval(() =>{
        var flag = true;
        for(var attr in json){

            var current = 0;
            var target = 0;
            var step = 0;


            if(attr == "opacity"){
                current = getStyle(oEle, attr) * 100;
                target = parseInt(json[attr] * 100);
            }else {
                current = parseInt(getStyle(oEle, attr));
                target =parseInt(json[attr]);
            }

            step = (target - current) / 10;
            step = step > 0 ? Math.ceil(step) : Math.floor(step);

            if(attr == "opacity"){
                oEle.style[attr] = (current + step) / 100;
                oEle.style.filter=`alpha(opacity=${current + step})`;

                //ie

            } else if(attr=="zIndex"){
                oEle.style[attr] = json[attr];
            }else{
                oEle.style[attr] = current + step + "px";
            }

            if(current != target){
                flag = false;
            }
        }

        if(flag){
            clearInterval(oEle.timer);
            if(typeof(callback) == "function"){
                callback();
            }
        }
    },40)
}